home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / lists / mint / l_1199 / 1738 < prev    next >
Encoding:
Internet Message Format  |  1994-08-27  |  1.6 KB

  1. Date: Thu, 21 Jul 1994 18:38:54 -0400
  2. From: "Nicholas S Castellano" <entropy@terminator.rs.itd.umich.edu>
  3. To: steve@earth.ox.ac.uk
  4. Subject: passwd.c (MiNTOS 1.2) patches
  5.  
  6. This patch fixes three bugs in mintos/usrbin/passwd.c from MiNTOS 1.2.
  7.  
  8. - root must be allowed to change any user's password
  9. - ensure echo is disabled when reading new password after a retry
  10. - generate only valid salts for crypt
  11.  
  12. --- passwd.c_orig    Sat Apr  9 10:29:38 1994
  13. +++ passwd.c    Thu Jul 21 18:08:02 1994
  14. @@ -109,8 +109,9 @@
  15.          if ((check_passwd((char *)(crypt(oldpassword, key)), pswdent->pw_passwd) == 1) && (noentry == 0))
  16.              oktologin = 1;
  17.      }
  18. +    else if (starting_uid == 0)
  19. +        oktologin = 1;
  20.  
  21. -
  22.      endpwent();
  23.  
  24.      if (!oktologin)
  25. @@ -121,9 +122,9 @@
  26.  
  27.      if ((oktologin == 1) && (noentry == 0))
  28.      {
  29. -        ioctl(fileno(stdin), TIOCSETP, &noecho);
  30. +retry:        ioctl(fileno(stdin), TIOCSETP, &noecho);
  31.  
  32. -retry:        printf("New password:");
  33. +        printf("New password:");
  34.          fflush(stdout);
  35.          fgets(newpassword1, MAX_PASSWORD_LENGTH, stdin);
  36.          newpassword1[strlen(newpassword1) - 1] = '\0';
  37. @@ -178,14 +179,17 @@
  38.  char key[3];
  39.  {
  40.      int value, i;
  41. +    char *salts = 
  42. +      "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789./";
  43. +    int saltslen;
  44.  
  45. +    saltslen = strlen(salts);
  46.      srand(time(0L));
  47.  
  48.      for (i = 0; i < 2; i++)
  49.      {
  50.          value = rand();
  51. -        while ((key[i] = (char)((value % 94) + 33)) == ':')
  52. -            value = rand();
  53. +        key[i] = (char)(salts[value % saltslen]);
  54.      }
  55.  
  56.      key[2] = '\0';
  57.  
  58. --
  59. entropy -- it's not just a good idea, it's the second law.
  60. Personal mail:      entropy@gnu.ai.mit.edu
  61. MiNT library mail:  entropy@terminator.rs.itd.umich.edu
  62. "what do you have against octal?" -jrb
  63.  
  64.